﻿<UserControl x:Class="ModernWSPView.Pages.PageListContentTypesTree"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:mui="http://firstfloorsoftware.com/ModernUI"
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300">
    <UserControl.Resources>
        <HierarchicalDataTemplate DataType="ContentType"
                                  ItemsSource="{Binding XPath=./*}">
            <Grid Background="#FFFFDBBA">
                <Grid.RowDefinitions>
                    <RowDefinition />
                    <RowDefinition />
                    <RowDefinition />
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="100px" />
                    <ColumnDefinition />
                </Grid.ColumnDefinitions>

                <TextBlock Text="Id" Grid.Column="0" Grid.Row="0" FontWeight="Bold" />
                <TextBox Margin="0"  Grid.Column="1" Grid.Row="0"
                           Text="{Binding XPath=@ID}" IsReadOnly="True" BorderBrush="{x:Null}" Background="{x:Null}"/>
                
                <TextBlock Text="Name" Grid.Column="0" Grid.Row="1" FontWeight="Bold" />
                <TextBox Margin="5,0,0,0" Grid.Column="1" Grid.Row="1"
                           Text="{Binding XPath=@Name}" IsReadOnly="True" BorderBrush="{x:Null}" Background="{x:Null}"/>

                <TextBlock Text="Group" Grid.Column="0" Grid.Row="2" FontWeight="Bold" />
                <TextBox Margin="5,0,0,0" Grid.Column="1" Grid.Row="2"
                           Text="{Binding XPath=@Group}" IsReadOnly="True" BorderBrush="{x:Null}" Background="{x:Null}"/>

            </Grid>
            <!--<StackPanel Orientation="Horizontal" Background="#FFFFD59A">
                <TextBlock Margin="0"
                           Text="{Binding XPath=@Id}" />
                <TextBlock Margin="5,0,0,0"
                           Text="{Binding XPath=@Name}" />
                <TextBlock Margin="5,0,0,0"
                           Text="{Binding XPath=@Group}" />
            </StackPanel>-->
        </HierarchicalDataTemplate>
        <HierarchicalDataTemplate DataType="FieldRefs"
                                  ItemsSource="{Binding XPath=./FieldRefs}">
            <DataGrid ItemsSource="{Binding XPath=./FieldRef}" AutoGenerateColumns="False">
                <DataGrid.Columns>
                    <DataGridTextColumn Header="ID" Binding="{Binding XPath=@ID}" HeaderStyle="{StaticResource ResourceKey=AlignLeftHeaderStyle}"/>
                    <DataGridTextColumn Header="Name"  Binding="{Binding XPath=@Name}" HeaderStyle="{StaticResource ResourceKey=AlignLeftHeaderStyle}"/>
                </DataGrid.Columns>
            </DataGrid>
        </HierarchicalDataTemplate>
    </UserControl.Resources>
    <Grid Style="{StaticResource ContentRoot}">
        <ScrollViewer>
            <StackPanel MinWidth="200">
                <TextBlock Text="Types de contenus" Style="{StaticResource Heading2}" />
                <Grid DataContext="{DynamicResource ResourceKey=globalXmlDataSource}">
                    <TreeView Name="dirTree"
                      HorizontalAlignment="Stretch"
                      VerticalAlignment="Stretch"
                      ItemsSource="{Binding XPath='//ContentType'}"
                      VirtualizingStackPanel.IsVirtualizing="False"
                      VirtualizingStackPanel.VirtualizationMode="Standard" />
                </Grid>
            </StackPanel>
        </ScrollViewer>
    </Grid>
</UserControl>
